<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Register</title>
    </h:head>
    <h:body>
        
        <f:facet name="last">
            <h:outputStylesheet library="user/css" name="register_default.css"/>
	</f:facet>
        
        <h:form id="form" class="register" prependId="false" enctype="multipart/form-data">
            
            <h1>Registration</h1>
            <fieldset class="row1">
                <legend>Account Details
                </legend>
                
                <p:messages id="messages" showDetail="true" autoUpdate="true" closable="true" />
                <p>
                    <h:outputLabel for="username" value="Username *"/>
                    <p:inputText id="username" value="#{u_memberManagedBean.member.username}">
                        <f:validator validatorId="Validation.Username"/>
                    </p:inputText>
                    
                    <h:outputLabel for="Nickname" value="Nick Name *"/>
                    <p:inputText id="Nickname" value="#{u_memberManagedBean.member.nickName}" required="true"/>
                </p>
                <p>
                    <h:outputLabel for="pwd1" value="Password *"/>
                    <p:password id="pwd1" value="#{u_memberManagedBean.member.password}" feedback="true" 
                                required="true" label="Password" match="pwd2"/>
                    
                    <h:outputLabel for="pwd2" value="Repeat Password *"/>
                    <p:password id="pwd2" value="#{u_memberManagedBean.member.password}" 
                                required="true"  feedback="true" label="Password repeat"/>
                </p>
                <p>
                    <h:outputLabel for="Email" value="Email *"/>
                    <p:inputText id="Email" value="#{u_memberManagedBean.member.email}" required="true"
                                 converterMessage="Email is invalid !!!"/>
                    
                    <h:outputLabel for="Birthday" value="Birthday *"/>
                    <p:calendar id="Birthday" effect="explode" value="#{u_memberManagedBean.member.birthday}"
                                pattern="dd/MM/yyyy">
                        <f:validator validatorId="Validation.Birthday"/>
                    </p:calendar>
                    
                    <label class="obinfo">* obligatory fields</label>
                </p>
            </fieldset>
            <fieldset class="row2">
                <legend>Personal Details
                </legend>
                <p>
                    <h:outputLabel value="Avatar :"/>
                    <p:fileUpload value="#{u_albumManagedBean.file}" mode="simple"
                          multiple="false" dragDropSupport="false" update="messages" 
                          sizeLimit="1000000" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />
                </p>
                <p>
                    <h:outputLabel value="Full Name"/>
                    <p:inputText styleClass="long" value="#{u_memberManagedBean.member.fullName}"/>
                </p>
                <p>
                    <h:outputLabel value="Address"/>
                    <p:inputText styleClass="long" value="#{u_memberManagedBean.member.address}"/>
                </p>
                <p>
                    <h:outputLabel value="Contact Number"/>
                    <p:inputText styleClass="long" value="#{u_memberManagedBean.member.contactNumber}"/>
                </p>
                <p>
                    <h:outputLabel value="Language *"/>
                    #{a_languageManagedBean.set_list()}
                    <p:selectOneMenu id="MenuLanguage" value="#{u_memberManagedBean.member.IDLanguage.id}" 
                                     styleClass="selectMenu" required="true" label="Menu Language">
                        <f:selectItem itemLabel="Select Language" itemValue=""/>
                        <f:selectItems var="language" value="#{a_languageManagedBean.list}" 
                                       itemLabel="${language.language}" itemValue="${language.id}"/>
                    </p:selectOneMenu>
                </p>
                <p>
                    <h:outputLabel value="Country *"/>
                    #{a_countryManagedBean.set_list()} 
                    <p:selectOneMenu id="MenuCountry" value="#{u_memberManagedBean.IDCountry}" 
                                     styleClass="selectMenu"  required="true" label="Menu Country">
                        <f:selectItem itemLabel="Select Country" itemValue=""/>
                        <f:selectItems var="country" value="#{a_countryManagedBean.list}" 
                                       itemValue="${country.id}" itemLabel="${country.country}"/>
                        <p:ajax update="MenuState" listener="#{u_memberManagedBean.handleStateChange()}"/>
                    </p:selectOneMenu>
                </p>
                <p>
                    <h:outputLabel value="State *"/>
                    <p:selectOneMenu id="MenuState" value="#{u_memberManagedBean.member.IDState.id}" 
                                     styleClass="selectMenu" required="true" label="Menu State">
                        <f:selectItem itemLabel="Select Status" itemValue=""/>
                        <f:selectItems var="state" value="#{u_memberManagedBean.lstState}"
                                       itemLabel="${state.state}" itemValue="${state.id}"/>
                    </p:selectOneMenu>
                </p>
                <p>
                    <h:outputLabel value="Marital *"/>
                    #{a_maritalManagedBean.set_list()}
                    <p:selectOneMenu id="MenuMarital" value="#{u_memberManagedBean.member.IDMarital.id}" 
                                     styleClass="selectMenu" required="true" label="Menu Marital">
                        <f:selectItem itemLabel="Select Marital" itemValue=""/>
                        <f:selectItems var="marital" value="#{a_maritalManagedBean.list}"
                                       itemLabel="${marital.maritalStatus}" itemValue="${marital.id}"/>
                    </p:selectOneMenu>
                </p>
                <p>
                    <h:outputLabel value="Religion *"/>
                    #{a_religionManagedBean.set_list()}
                    <p:selectOneMenu id="MenuReligion" value="#{u_memberManagedBean.member.IDReligion.id}"
                                     styleClass="selectMenu" required="true" label="Menu Religion">
                        <f:selectItem itemLabel="Select Religion" itemValue=""/>
                        <f:selectItems var="religion" value="#{a_religionManagedBean.list}"
                                       itemLabel="${religion.religion}" itemValue="${religion.id}"/>
                    </p:selectOneMenu>
                </p>
                <p>
                    <h:outputLabel value="Caste *"/>
                    #{a_casteManagedBean.set_list()}
                    <p:selectOneMenu id="MenuCaste" value="#{u_memberManagedBean.member.IDCasle.id}"
                                     styleClass="selectMenu" required="true" label="Menu Caste">
                        <f:selectItem itemLabel="Select Caste" itemValue=""/>
                        <f:selectItems var="caste" value="#{a_casteManagedBean.list}"
                                       itemLabel="${caste.caste}" itemValue="${caste.id}"/>
                    </p:selectOneMenu>
                </p>
            </fieldset>
            <fieldset class="row3">
                <legend>Further Information
                </legend>
                <p>
                    <h:outputLabel value="Gender *"/>
                    <p:selectOneRadio id="Gender" value="#{u_memberManagedBean.member.gender}">
                        <f:selectItem itemLabel="Male" itemValue="true" />
                        <f:selectItem itemLabel="Female" itemValue="false" />
                    </p:selectOneRadio>
                </p>
                <p>
                    <h:outputLabel value="Hobbies"/>
                    <p:inputText styleClass="long" value="#{u_memberManagedBean.member.hobbies}"/>
                </p>
                <p>
                    <h:outputLabel value="Family"/>
                    <p:inputText styleClass="long" value="#{u_memberManagedBean.member.family}"/>
                </p>
                <p>
                    <h:outputLabel value="Working At"/>
                    <p:inputText styleClass="long" value="#{u_memberManagedBean.member.workingAt}"/>
                </p>
                <p>
                    <h:outputLabel value="Height"/>
                    <p:inputText styleClass="long" value="#{u_memberManagedBean.member.height}"/>
                </p>
                <div class="infobox"><h4>Captcha Information</h4>
                    <p>
                        <p:captcha id="capcha" label="Captcha" language="tr"/>
                    </p>
                </div>
            </fieldset>
            <div>
                <p:commandButton ajax="false" styleClass="button" value="Register" action="#{u_memberManagedBean.create()}"/>
            </div>
        </h:form>
    </h:body>
</html>

